<?php
abstract class Mivec_Mage_Abstract 
{
	protected $_config;
	
	public function _init()
	{
		self::setEnviroment();
	}
	
	public function setEnviroment()
	{
		$config = Zend_Registry::get('config');
		$this->_config = $config->product_base;
		
		//set libpath
		set_include_path(implode(PATH_SEPARATOR, array(
			get_include_path(),
			$this->_config->path,
		)));
		//echo get_include_path();
		require 'app/Mage.php';
		Mage::app('default');
	}
	
	public function getConfig()
	{
		return $this->_config;
	}
	
	public function getPath()
	{
		return $this->_config->path;
	}
	
	public function getResource()
	{
		return Mage::getSingleton("core/resource")->getConnection("core_write"); 
	}
	
	public function getProduct()
	{
		return Mage::getModel('catalog/product');
	}
}